package com.mujin.keji.collectionsystem.module.recording.views;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.mujin.keji.collectionsystem.CcsApplication;
import com.mujin.keji.collectionsystem.R;
import com.mujin.keji.collectionsystem.base.BaseActivity;
import com.mujin.keji.collectionsystem.listeners.CustomItemClickListener;
import com.mujin.keji.collectionsystem.module.main.views.MainActivity;
import com.mujin.keji.collectionsystem.module.recording.adapter.RecordAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * 录音列表Activity界面
 *
 * @author weishixiong
 * @Time 2018-03-22
 */

public class RecordListActivity extends BaseActivity implements CustomItemClickListener {
    private RecordAdapter recordAdapter;
    private LinearLayoutManager linearLayoutManager;
    private RecyclerView rvMessage;
    private List<String> recordList;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        CcsApplication.addActivity(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        CcsApplication.removeActivity(this);
    }
    @Override
    protected void createViewModel() {

    }

    @Override
    public int intiLayout() {
        return R.layout.activity_message;
    }

    @Override
    public void initView() {
        setCenterTitle("报警录音", "#FFFFFF");
        setleftImage(R.drawable.image_arrow_left_white, true, null);
        setrightImage(R.drawable.image_home_white, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
                CcsApplication.clearSpecifyActivities(new Class[]{MainActivity.class});
                startActivity(new Intent(RecordListActivity.this, MainActivity.class));
            }
        });
        rvMessage = (RecyclerView) findViewById(R.id.rv_message);
        iniMessageListView();
    }

    /**
     * 初始化消息列表视图
     */
    private void iniMessageListView() {
        linearLayoutManager = new LinearLayoutManager(this);
        rvMessage.setLayoutManager(linearLayoutManager);
        recordList = new ArrayList<>();
        recordList.add("a");
        recordList.add("a");
        recordList.add("a");
        recordList.add("a");
        recordAdapter = new RecordAdapter(this, recordList, this);
        rvMessage.setAdapter(recordAdapter);
    }

    @Override
    public void initData() {

    }

    @Override
    public void initListener() {

    }

    @Override
    public void onItemClick(View view, int position) {

    }
}
